using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class currencyMap : EntityTypeConfiguration<currency>
    {
        public currencyMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.DESCRIP)
                .HasMaxLength(20);

            this.Property(t => t.SYMBOL)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.DESC_ARB)
                .HasMaxLength(20);

            this.Property(t => t.SYMB_ARB)
                .HasMaxLength(5);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            this.Property(t => t.ARACCT)
                .HasMaxLength(40);

            this.Property(t => t.APACCT)
                .HasMaxLength(40);

            this.Property(t => t.Acct_local_Revenue_onaccount)
                .HasMaxLength(40);

            this.Property(t => t.Acct_local_Revenue_cash)
                .HasMaxLength(40);

            this.Property(t => t.Acct_export_revenue_onaccount)
                .HasMaxLength(40);

            this.Property(t => t.Acct_export_revenue_cash)
                .HasMaxLength(40);

            this.Property(t => t.Acct_transit_revenue_onaccount)
                .HasMaxLength(40);

            this.Property(t => t.Acct_transit_revenue_cash)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Local_vat_onaccount)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Local_vat_cash)
                .HasMaxLength(40);

            this.Property(t => t.Acct_vat_on_purchase_import)
                .HasMaxLength(40);

            this.Property(t => t.Acct_vat_on_purchase_manual)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Return_on_sale_cash)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Return_on_sale_onaccount)
                .HasMaxLength(40);

            this.Property(t => t.Acct_cost_of_good)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Inventory)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Local_Cash)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Return_Cash_Transit)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Return_Cash_Export)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Return_OnAccount_Transit)
                .HasMaxLength(40);

            this.Property(t => t.Acct_Return_OnAccount_Export)
                .HasMaxLength(40);

            // Table & Column Mappings
            this.ToTable("currency");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.DESCRIP).HasColumnName("DESCRIP");
            this.Property(t => t.SYMBOL).HasColumnName("SYMBOL");
            this.Property(t => t.DESC_ARB).HasColumnName("DESC_ARB");
            this.Property(t => t.SYMB_ARB).HasColumnName("SYMB_ARB");
            this.Property(t => t.PROTECTED).HasColumnName("PROTECTED");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.ARACCT).HasColumnName("ARACCT");
            this.Property(t => t.APACCT).HasColumnName("APACCT");
            this.Property(t => t.PRICEACCURACY).HasColumnName("PRICEACCURACY");
            this.Property(t => t.Acct_local_Revenue_onaccount).HasColumnName("Acct_local_Revenue_onaccount");
            this.Property(t => t.Acct_local_Revenue_cash).HasColumnName("Acct_local_Revenue_cash");
            this.Property(t => t.Acct_export_revenue_onaccount).HasColumnName("Acct_export_revenue_onaccount");
            this.Property(t => t.Acct_export_revenue_cash).HasColumnName("Acct_export_revenue_cash");
            this.Property(t => t.Acct_transit_revenue_onaccount).HasColumnName("Acct_transit_revenue_onaccount");
            this.Property(t => t.Acct_transit_revenue_cash).HasColumnName("Acct_transit_revenue_cash");
            this.Property(t => t.Acct_Local_vat_onaccount).HasColumnName("Acct_Local_vat_onaccount");
            this.Property(t => t.Acct_Local_vat_cash).HasColumnName("Acct_Local_vat_cash");
            this.Property(t => t.Acct_vat_on_purchase_import).HasColumnName("Acct_vat_on_purchase_import");
            this.Property(t => t.Acct_vat_on_purchase_manual).HasColumnName("Acct_vat_on_purchase_manual");
            this.Property(t => t.Acct_Return_on_sale_cash).HasColumnName("Acct_Return_on_sale_cash");
            this.Property(t => t.Acct_Return_on_sale_onaccount).HasColumnName("Acct_Return_on_sale_onaccount");
            this.Property(t => t.Acct_cost_of_good).HasColumnName("Acct_cost_of_good");
            this.Property(t => t.Acct_Inventory).HasColumnName("Acct_Inventory");
            this.Property(t => t.Acct_Local_Cash).HasColumnName("Acct_Local_Cash");
            this.Property(t => t.CUR_Parity).HasColumnName("CUR_Parity");
            this.Property(t => t.Acct_Return_Cash_Transit).HasColumnName("Acct_Return_Cash_Transit");
            this.Property(t => t.Acct_Return_Cash_Export).HasColumnName("Acct_Return_Cash_Export");
            this.Property(t => t.Acct_Return_OnAccount_Transit).HasColumnName("Acct_Return_OnAccount_Transit");
            this.Property(t => t.Acct_Return_OnAccount_Export).HasColumnName("Acct_Return_OnAccount_Export");

            // Relationships
            this.HasOptional(t => t.Acct)
                .WithMany(t => t.currencies)
                .HasForeignKey(d => d.ARACCT);
            this.HasOptional(t => t.Acct1)
                .WithMany(t => t.currencies1)
                .HasForeignKey(d => d.APACCT);

        }
    }
}
